/**
 * @file solver.cpp
 * @author luozi
 * @brief  Implementing solver.h
 * @version 0.1
 * @date 2024-06-06
 * 
 * @copyright Copyright (c) 2024 luozi
 * 
 */
#include "solver.h"
#include <math.h>
std::string Solver::solve2d(double a, double b, double c){
    if(a == 0){
        return "Not a quadratic equation";
    }
    double delta = b*b - 4*a*c;
    if (delta < 0){
        return "The equation has no real roots";
    }else if (delta == 0){
        return std::to_string(-b/(2*a));
    }else {
        double ret1 = (-b + sqrt(delta))/(2*a);
        double ret2 = (-b - sqrt(delta))/(2*a);
        return std::to_string(ret1) + " and " + std::to_string(ret2);
    }
}